<?php

class errorMessage {

 // p1 : name (feldname?) ; p2 : Msg
 function registerErrorMsg(&$shop,$params){
   $this->errorMsg[$params[0]] = $params[1];
 }

 // p1 : System Error Msg; p2 : prefix; p3 : separator; p4 : suffix
 function showErrorMsg(&$shop,$params){
   $errors = split(",",$params[0]);
   $str .= $params[1]; // prefix
   $first = 1;
   foreach ($errors As $e){
     if (!$first){
       $str .= $params[2]; // separator
     } else {
       $first = 0;
     }
     $str .= $this->errorMsg[$e]; // registered Msg
   }
   $shop->out($str.$params[3]); // all + suffix
 }

 function unregisterErrorMsgs(){
   unset($this->errorMsg);
 }

 // p1 : System Error Msg;
 function isError(&$shop,$params){
   if (preg_match("/".$params[1]."/i",$params[0])) return true;
 }

}

?>